package com.init.iblog.controller;

import com.init.iblog.domain.ResponseResult;
import com.init.iblog.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文章分类控制层
 */
@RestController
@RequestMapping("/category")
@CrossOrigin    //解决跨域问题
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 获取文章分类
     * @return
     */
    @GetMapping("/getCategoryList")
    public ResponseResult getCategoryList(){

        System.out.println("++++++++++++++++进入/getCategoryList获取文章分类接口++++++++++++++++");
        return categoryService.getCategoryList();
    }
}
